package com.ls.fw.search.lucene.bean;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class ComparatorLong implements Comparator<String>{

	@Override
	public int compare(String o1, String o2) {
		   long user0 = Long.valueOf(o1);
		   long user1 = Long.valueOf(o2);

		   if(user0 > user1){
			   return -1;
		   }else if(user0 < user1){
			   return 1;
		   }
		return 0;
	}
	
	
	public static void main(String[] args) {
		List<String> list  = new ArrayList<String>();
		list.add("20121211");
		list.add("20121212");
		list.add("20121210");
		list.add("20121215");
		Collections.sort(list, new ComparatorLong());
		System.out.println(list);
	}
}